﻿<%@ Page Language="VB" MasterPageFile="~/HelpDesk.master" AutoEventWireup="false"
    CodeFile="Projets.aspx.vb" Inherits="Admin_Projets" Title="Gestion projets" Theme="HelpDesk"
    Culture="auto" meta:resourcekey="PageResource1" UICulture="auto" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <h1>
        <asp:Literal ID="Literal1" runat="server" meta:resourcekey="Literal1Resource1" Text="Projets"></asp:Literal>
    </h1>
    <table width="100%">
        <tr>
            <td width="50%">
                <a href="ProjetsForm.aspx">
                    <img src="../Images/Icones/brick_add.png" alt="" />
                    <asp:Literal ID="Literal2" runat="server" meta:resourcekey="Literal2Resource1" Text="Nouveau projet"></asp:Literal>
                </a>
            </td>
            <td align="right" width="50%">
                <asp:SqlDataSource ID="SqlClients" runat="server" ConnectionString="<%$ ConnectionStrings:HelpDeskCS %>"
                    SelectCommand="SELECT [entreprise_id], [entreprise_nom] FROM [Entreprise] ORDER BY [entreprise_nom]">
                </asp:SqlDataSource>
                <asp:DropDownList ID="DropDownListClients" runat="server" DataSourceID="SqlClients"
                    DataTextField="entreprise_nom" DataValueField="entreprise_id" AppendDataBoundItems="True"
                    meta:resourcekey="DropDownListClientsResource1">
                    <asp:ListItem Value="" Text="----- Client -----" meta:resourcekey="ListItemResource1"></asp:ListItem>
                </asp:DropDownList>
                <asp:SqlDataSource ID="SqlEtat" runat="server" ConnectionString="<%$ ConnectionStrings:HelpDeskCS %>"
                    SelectCommand="SELECT [etatprojet_id], [etatprojet_label] FROM [EtatProjet] ORDER BY [etatprojet_ordre]">
                </asp:SqlDataSource>
                <asp:DropDownList ID="DropDownListEtat" runat="server" DataSourceID="SqlEtat" DataTextField="etatprojet_label"
                    DataValueField="etatprojet_id" AppendDataBoundItems="True" meta:resourcekey="DropDownListEtatResource1">
                    <asp:ListItem Value="" Text="----- Etat -----" meta:resourcekey="ListItemResource2"></asp:ListItem>
                </asp:DropDownList>
                <asp:Button ID="ButtonFiltrer" runat="server" Text="Filtrer" meta:resourcekey="ButtonFiltrerResource1" />
            </td>
        </tr>
    </table>
    <asp:SqlDataSource ID="SqlProjets" runat="server" ConnectionString="<%$ ConnectionStrings:HelpDeskCS %>"
        SelectCommand="SELECT Projet.projet_id, Projet.projet_nom, Projet.projet_support, Projet.projet_url, Projet.projet_version, (SELECT entreprise_nom FROM Entreprise WHERE (entreprise_id = Projet.entreprise_id)) AS client, EtatProjet.etatprojet_label, EtatProjet.etatprojet_livre, (SELECT COUNT(*) AS nb FROM Ticket WHERE (Projet.projet_id = projet_id)) AS nbTickets FROM Projet INNER JOIN EtatProjet ON Projet.etatprojet_id = EtatProjet.etatprojet_id WHERE (Projet.entreprise_id = CASE WHEN @client IS NULL THEN entreprise_id ELSE @client END) AND (Projet.etatprojet_id = CASE WHEN @etat IS NULL THEN Projet.etatprojet_id ELSE @etat END) ORDER BY client, Projet.projet_nom"
        CancelSelectOnNullParameter="False">
        <SelectParameters>
            <asp:ControlParameter ControlID="DropDownListClients" Name="client" PropertyName="SelectedValue" />
            <asp:ControlParameter ControlID="DropDownListEtat" Name="etat" PropertyName="SelectedValue" />
        </SelectParameters>
    </asp:SqlDataSource>
    <asp:GridView ID="GridViewProjets" runat="server" AutoGenerateColumns="False" DataKeyNames="projet_id"
        DataSourceID="SqlProjets" meta:resourcekey="GridViewProjetsResource1">
        <Columns>
            <asp:TemplateField meta:resourcekey="TemplateFieldResource1">
                <ItemTemplate>
                    <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# Eval("projet_id", "ProjetsForm.aspx?projet_id={0}") %>'
                        meta:resourcekey="HyperLink1Resource1" Text="
                        &lt;img src=&quot;../Images/Icones/brick_edit.png&quot; alt=&quot;Modifier le projet&quot; /&gt;
                    "></asp:HyperLink>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Projet" meta:resourcekey="TemplateFieldResource2"
                SortExpression="projet_nom">
                <ItemTemplate>
                    <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# Eval("projet_id", "ProjetsForm.aspx?projet_id={0}") %>'
                        Text='<%# Eval("projet_nom") %>' meta:resourcekey="HyperLink1Resource2"></asp:HyperLink>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="client" HeaderText="Client" SortExpression="client" meta:resourcekey="BoundFieldResource1" />
            <asp:TemplateField HeaderText="URL" SortExpression="projet_url" meta:resourcekey="TemplateFieldResource3">
                <ItemTemplate>
                    <asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl='<%# Eval("projet_url", "{0}") %>'
                        Target="_blank" Visible='<%# URLVisible(Eval("projet_url")) %>' meta:resourcekey="HyperLink2Resource1"
                        Text="&lt;img src=&quot;../Images/Icones/world_link.png&quot; alt=&quot;Lien&quot; /&gt;"></asp:HyperLink>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="etatprojet_label" HeaderText="Etat" SortExpression="etatprojet_label"
                meta:resourcekey="BoundFieldResource2" />
            <asp:BoundField DataField="nbTickets" HeaderText="Tickets" SortExpression="nbTickets"
                meta:resourcekey="BoundFieldResource3" />
            <asp:CheckBoxField DataField="etatprojet_livre" HeaderText="Livr&#233;" SortExpression="etatprojet_livre"
                meta:resourcekey="CheckBoxFieldResource1" />
        </Columns>
    </asp:GridView>
</asp:Content>
